package com.xd.cloud.dao.vehicle;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;

import com.xd.cloud.dao.BaseDao;
import com.xd.cloud.entity.vehicle.GpsData;

/**   
 * 功能描述：实时定位数据Dao
 * @author: wangshanshan   
 * @date: 2017年12月19日 下午4:42:33 
 */
@Repository
public class GpsDataDao extends BaseDao<GpsData> {
	
	public List<Object[]> getGpsDataRuntime(String device_id) {
		String sql = "select v.vehid,gps.device_id,lng,lat,ifnull(speed,0) speed,ifnull(direction,0) direction,acc,ifnull(mileage,0) mileage,ifnull(ol,0) ol,ifnull(gps.status,'') status,csq,date_format(gpstime,'%Y-%m-%d %T') gpstime "
				+ "from tb_gps_data_runtime gps, tb_vehicle v where lng is not null and lat is not null and gps.device_id = v.devicecode and gps.device_id in ("+device_id+")";
		return findSql(sql, new Object[]{});
	}
}
